From: Florian Müllner Date: Wed, 1 Oct 2025 18:19:14 +0000 (+0200) Subject: messageList: Make media messages follow notification policy X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~80^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5714504a6fc7d8b0b47bbe3f3368b930ee82b44d;p=gnome-shell.git messageList: Make media messages follow notification policy Unlike regular notifications, media messages are shown unconditionally for any active MPRIS player. In the past that was uncontroversial, but now that media messages are shown on the lock screen as well, there is a privacy concern. To address this, make media messages follow the notification policy of the corresponding app (if specified) or the general notification settings. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8600 Part-of: --- diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 265d7a3f9..ee4f7e258 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -793,6 +793,8 @@ class MediaMessage extends Message { this._player.next(); }); + Main.sessionMode.connectObject('updated', + () => this._applyPolicy(), this); this._player.connectObject('changed', this._update.bind(this), this); this._update(); } @@ -805,6 +807,12 @@ class MediaMessage extends Message { Main.panel.closeCalendar(); } + _applyPolicy() { + this.visible = + this._policy.enable && + (!Main.sessionMode.isLocked || this._policy.showInLockScreen); + } + _updateNavButton(button, sensitive) { button.reactive = sensitive; } @@ -832,6 +840,22 @@ class MediaMessage extends Message { this._updateNavButton(this._prevButton, this._player.canGoPrevious); this._updateNavButton(this._nextButton, this._player.canGoNext); + + const appId = this._player.app?.id.replace(/\.desktop$/, ''); + if (this._policy?.id !== appId) { + this._policy?.disconnectObject(this); + + this._policy = MessageTray.NotificationPolicy.newForApp(this._player.app); + + // Register notification source + this._policy.store(); + + this._policy.connectObject( + 'notify::enable', () => this._applyPolicy(), + 'notify::show-in-lock-screen', () => this._applyPolicy(), + this); + this._applyPolicy(); + } } });